package com.tyl.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tyl.service.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.management.openmbean.OpenDataException;

@RestController
@RequestMapping("/order")

public class OrderController {
    @Autowired
    private OrderFeignService os;
    @GetMapping("/selectAll")
    @HystrixCommand(fallbackMethod = "getHystrixInfo")
    public String OrderSelectAll(){
        String s = os.selectById(1);
        return "这是订单的查询所有方法"+"这是查询商品的方法"+s;
    }

    public String getHystrixInfo(){
        return "熔断错误，稍后重试";
    }


}
